#include "ZenMaterial.h"

CZenMaterial::CZenMaterial()
{
	ZeroMemory(&m_Material, sizeof(D3DMATERIAL8));

	m_Material.Diffuse.r = 1.0f;
	m_Material.Diffuse.g = 1.0f;
	m_Material.Diffuse.b = 1.0f;
}

CZenMaterial::~CZenMaterial()
{
}

void CZenMaterial::SetDiffuse(float r, float g, float b)
{
	m_Material.Diffuse.r = r;
	m_Material.Diffuse.g = g;
	m_Material.Diffuse.b = b;
}

void CZenMaterial::SetAmbient(float r, float g, float b)
{
	m_Material.Ambient.r = r;
	m_Material.Ambient.g = g;
	m_Material.Ambient.b = b;
}

void CZenMaterial::SetSpecular(float r, float g, float b, float power)
{
	m_Material.Specular.r = r;
	m_Material.Specular.g = g;
	m_Material.Specular.b = b;
	m_Material.Power = power;
}

void CZenMaterial::SetEmissive(float r, float g, float b)
{
	m_Material.Emissive.r = r;
	m_Material.Emissive.g = g;
	m_Material.Emissive.b = b;
}

void CZenMaterial::SetMaterial(D3DMATERIAL8 mat)
{
	m_Material = mat;
}

HRESULT CZenMaterial::Update()
{
	return zen.m_pDevice->SetMaterial(&m_Material);
}

D3DCOLORVALUE CZenMaterial::GetDiffuse()
{
	return m_Material.Diffuse;
}

D3DCOLORVALUE CZenMaterial::GetAmbient()  
{
	return m_Material.Ambient;
}

D3DCOLORVALUE CZenMaterial::GetSpecular()
{
	return m_Material.Specular;
}

D3DCOLORVALUE CZenMaterial::GetEmissive()  
{
	return m_Material.Emissive;
}
